﻿namespace Probel.PersonalNotes.Models.Home
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Data.Entity.Core.Objects;
    using System.Data.Entity.Infrastructure;
    using System.Linq;
    using System.Web;

    internal class EventsDbContext : DbContext
    {
        #region Constructors

        public EventsDbContext()
            : base("DefaultConnection")
        {
        }

        #endregion Constructors

        #region Properties

        public DbSet<RecordViewModel> Events
        {
            get;
            set;
        }

        #endregion Properties

        #region Methods

        public ObjectResult<EventSummary> GetSummary()
        {
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery<EventSummary>("procSummary");
        }

        public ObjectResult<YearCount> GetsummaryByYear()
        {
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery<YearCount>("procSummaryByYear");
        }

        #endregion Methods
    }
}